package com.haojin.java;

public class PersonTest {
public static void main(String[] args) {
	Person1 b = new Person1();
	b.setAge(18);
	System.out.println("年龄为：" + b.getAge());
	
}


}

class Person1{
	private int age;
	public void setAge(int i){
		if(i >= 0 && i <=130){
			age = i;
		}
		else{
			System.out.println("输入的数据非法");
			return;
		}
	}
	public int getAge(){
			return age;
	}
}
